﻿using System;
using System.Web.UI;
using Microsoft.SharePoint;
using SCCL = SCCL2010;

namespace Test_SCCL.VisualWebPart1
{
    public partial class VisualWebPart1UserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            cmdButton1.Click += cmdButton1_Click;
            cmdButton2.Click += cmdButton2_Click;
            cmdTestPages.Click += cmdTest_Click;

        }

        void cmdTest_Click(object sender, EventArgs e)
        {
            if (!SCCL.Lists.HasList(SPContext.Current.Web, "Pages"))
            {
                SCCL.Libraries.CreateLibrary(SPContext.Current.Web, "Pages");
            }
            SCCL.Pages.EnsureWebPartPage(SPContext.Current.Web , "Pages", "TestPage1.aspx", SCCL.wpPageTypes.FullPageVertical);
            SCCL.Pages.EnsureListViewOnPage(SPContext.Current.Web, "Pages", "TestPage1.aspx", "Left", 1, "Configuration", "John", "My Test Add");




        }

        void cmdButton2_Click(object sender, EventArgs e)
        {
            


            txtStatus.Text = SCCL.Config.ReadConfigValue(SPContext.Current.Web, "Email");
        }

        void cmdButton1_Click(object sender, EventArgs e)
        {
            SCCL.Config.EnsureConfigValue(SPContext.Current.Web, "Email", "john.ramminger@gmail.com", "General");

        }
    }
}
